/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * ICheckSum Interface 
 *      Provides an interface definition for classes which implement checksums.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;

namespace Adaptive.Foundation
{
    /// <summary>
    /// Provides an interface definition for classes which implement checksums.
    /// </summary>
    public interface ICheckSum
    {
        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets the data checksum computed so far.
        /// </summary>
        /// <value>
        /// The current value of the checksum.
        /// </value>
        long Value
        {
            get;
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Methods / Functions
         *------------------------------------------------------------------------------*/
        #region Public Methods / Functions
        /// <summary>
        /// Resets the data checksum as if no update was ever called.
        /// </summary>
        void Reset();

        /// <summary>
        /// Adds one byte to the data checksum.
        /// </summary>
        /// <param name = "value">
        /// The data value to add. The high byte of the integer is ignored.
        /// </param>
        void Update(int value);

        /// <summary>
        /// Updates the data checksum with the bytes taken from the array.
        /// </summary>
        /// <param name="buffer">
        /// A byte array as the data buffer.
        /// </param>
        void Update(byte[] buffer);
        /// <summary>
        /// Adds the byte array to the data checksum.
        /// </summary>
        /// <param name = "buffer">
        /// The buffer which contains the data.
        /// </param>
        /// <param name = "offset">
        /// The offset in the buffer where the data starts.
        /// </param>
        /// <param name = "count">
        /// The number of bytes to be appended.
        /// </param>
        void Update(byte[] buffer, int offset, int count);
        #endregion
    }
}
